<?php
class FormEtudiant{
private $nom;
private $formation;
private $numEp;
private $groupe;
private $annee;

function __construct($nom, $numEp, $groupe, $annee) {
    $this->nom = $nom;
    $this->numEp = $numEp;
    $this->groupe = $groupe;
    $this->annee = $annee;
    
    if($annee == null){
         $this->annee=date("Y");
    }
}
    
    public static function bind(){
       $nom=isset($_POST["nom"])?$_POST["nom"]:null;
       $matiere=isset($_POST["matiere"])?$_POST["matiere"]:null;
       $groupe=isset($_POST["numGroupe"])?$_POST["numGroupe"]:null;
       $annee=isset($_POST["annee"])?$_POST["annee"]:null;
       $formFilter=null;
       if( isset($_POST["matiere"])){
             $formFilter = new  FormEtudiant($nom, $matiere, $groupe, $annee);
             $_SESSION["formFilterEtudiant"]=  serialize($formFilter);
        }else if (isset($_SESSION["formFilterEtudiant"]) && $_SESSION["formFilterEtudiant"]){
           $formFilter=unserialize($_SESSION["formFilterEtudiant"]);
        }else{
            $formFilter = new FormEtudiant($nom, $matiere, $groupe, $annee);
            $_SESSION["formFilterEtudiant"]=serialize($formFilter);
        }
       
       
       return $formFilter;                
    }
    public function isValid(){
        return true;
    }
    
    public function getNom() {
        return $this->nom;
    }

    public function setNom($nom) {
        $this->nom = $nom;
    }


    public function getNumEp() {
        return $this->numEp;
    }

    public function setNumEp($numEp) {
        $this->numEp = $numEp;
    }

    public function getGroupe() {
        return $this->groupe;
    }

    public function setGroupe($groupe) {
        $this->groupe = $groupe;
    }

    public function getAnnee() {
        return $this->annee;
    }

    public function setAnnee($annee) {
        $this->annee = $annee;
    }


		
}
?>